Skip to content

[bugfix] fix multimodal mtp#21

Merged
Jintao-Huang merged 1 commit intomodelscope:mainfrom
Jintao-Huang:fix_mtp_2
Apr 9, 2026
Merged

[bugfix] fix multimodal mtp#21
Jintao-Huang merged 1 commit intomodelscope:mainfrom
Jintao-Huang:fix_mtp_2

Conversation

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies src/mcore_bridge/model/gpt_model.py to add a None check for input_ids before calling split_cp_inputs, which prevents potential crashes during multimodal inference. The review points out a potential logical inconsistency: if input_ids are indeed required by MTP, as indicated by the new code comment, then the subsequent MTP processing block might still fail if input_ids is None but labels are present. It is suggested to either add a similar input_ids check to the MTP block or clarify its expected behavior.

Comment on lines +402 to +403
if self.config.is_multimodal and self.config.context_parallel_size > 1 and input_ids is not None:
# input_ids is required by MTP.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The addition of the input_ids is not None check prevents a crash in split_cp_inputs when input_ids are missing (e.g., during inference with decoder_input provided). However, the comment on line 403 states that input_ids is required by MTP. If this is the case, the MTP block starting at line 406 might still fail if input_ids is None while labels are present. It would be more robust to also check for input_ids at line 406 or clarify if MTP can indeed function without them.

@Jintao-Huang Jintao-Huang merged commit 6756621 into modelscope:main Apr 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant